package cn.lbf.stuniversity.vo;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import jakarta.validation.constraints.NotNull;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@JsonIgnoreProperties(ignoreUnknown = true)
public class PageForm {
    @JsonProperty(value = "页号", required = true)
    @NotNull(message = "pageNumber 不能为空")
    private int pageNumber;

    @JsonProperty(value = "页面大小", required = true)
    @NotNull(message = "pageSize 不能为空")
    private int pageSize;

    @JsonProperty(value = "页面大小", required = true)
    private int offSet;

    public void initOffSet(){
        this.offSet = (this.pageNumber - 1) * this.pageSize;
    }
}
